package calculators;

import javax.persistence.*;

import org.openxava.calculators.*;
import org.openxava.jpa.*;

import sistema_oficial.sistema_oficial.domain.sistemaoficial.*;

public class TipoFacturaVentaCalculator implements ICalculator{
	
	public Object calculate() throws Exception {
		TipoFacturaVenta auxiliar = null;
    	try{
    		Query query = XPersistence.getManager().createQuery("SELECT u FROM TipoFacturaVenta u WHERE u.porDefecto = :porDefecto");
    		query.setParameter("porDefecto", true);
    		if (query.getSingleResult()!= null) {
    			auxiliar = (TipoFacturaVenta) query.getSingleResult();	            	
    		}	
    	}
    	catch(Exception ex){
    		return auxiliar;
    	}
    	return auxiliar;
	}

}
